home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / utils / abe.arc / TINY_SRC.ABE < prev   
Text File  |  1989-06-22  |  10KB  |  169 lines

  1. ;ABE ASCII-Binary-Encoding (by Brad Templeton)
  2. ;Use 'sort' and/or 'dabe' to decode
  3. T./.$$filecount=2
  4. T.0N##S1000,1000,1000,ABE1
  5. T.1N$$blocking=false
  6. T.2R$$uname=tdabe1.c
  7. T.3a$$os=gemdos
  8. T.4J$$fname=tiny_src\tdabe1.c
  9. T.5y$$date=614524966
  10. T.6d$$perm=0
  11. T.75$$size=4021
  12. T.8S""%FB?>M=<;:M9:/7A6\54D318/MA.-,M+*)(M'%0&M
  13. T.9p""&.jJG%2%&'@()*+%,-`@%0123%4567%89^;%<=>?%
  14. T.AB""'@ABC@DEFG&HIJK)LMNO%PQRS.TUVW%XYZ[%z]^_(
  15. T.BL""(`abc@defg%hijk(lmno%pqrs.tuvw%xyzQ(qKDE)
  16. T.CA"")CHILMMNOPMRSTUMVWXYMZ[\]M_abcMdefgMhiklM
  17. T.Da""*mnopMrstuMvwxyM%&'(u)*+,u-./0u1234u5678u
  18. T.Eb""+9:;<u=>?@uABCDuEFGHuIJKLuMNOPuQRSTuUVWXu
  19. T.Fc"",YZ[\u]^_`uabcduefghuijklumnopuqrstuuvwxu
  20. T.GG\/@*.Tiny.ABE.'Ascii-Binary.Encoding'.Decoder.for.ABE1.(3.sets,.9
  21. T.HB4.printables)\/...'sort'.ALL.THE.INPUT.FILES.TO{GETHER.IF.THEY'RE
  22. T.IO.NOT.IN.ORDER`\/...Try.to.get.the.full.version.of.this.program.fr
  23. T.JYom.various.archives`\/...This.program.is.mainly.meant.as.a.tempor
  24. T.KDary.version.for.Unix.users`\/...DEFINE.THE.SYMBOL.JmsdosJ.on.DOS.
  25. T.LmMACHINES`\/...By.Brad.Templeton`..This.code.is.released.to.the.pu
  26. T.Mtblic.domain`..No\/...warranties.are.provided.or.implied`.*@\/\/\/
  27. T.NSGinclude.<stdio`h>\/Gifdef.msdos\/Ginclude.<fcntl`h>::@*.to.get.t
  28. T.OXhe.MSDOS.O_BINARY.symbol.only.*@\/Gendif.msdos\/Gdefine.OUR_VERSI
  29. T.PoON.1000\/Gdefine.MAX_LLEN.80::@*.max.output.line.len.*@\/Gdefine.
  30. T.QVNSETS.3:::@*.number.of.character.sets.*@\/Gdefine.NPRINTS.86::@*.
  31. T.RGnumber.of.printable.characters.*@\/Gdefine.FPRINT.'%'::@*.first.p
  32. T.SWrintable.character.used.*@\/Gdefine.LPRINT.'{z'::@*.last.printabl
  33. T.TQe.*@\/Gdefine.SETXX.'j'\/Gdefine.NEWSET1.'Q'\/Gdefine.SET10X.'K'\
  34. T.U1/Gdefine.SFBYTE.31\/Gdefine.NUM_SAFE.64\/Gdefine.CSUM_MOD.65536\/
  35. T.Vf\/@*.header.characters.*@\/Gdefine.CODE_HEAD.'J'\/Gdefine.MAIN_HE
  36. T.WmAD.'G'\/\/long.line_num;\/long.expected_sum.=.0;\/extern.long.ato
  37. T.XRl();\/int.whatbyte[NSETS][NPRINTS];:@*.array.maps.printables.to.b
  38. T.Yiytes.*@\/char.linbuf[MAX_LLEN];::@*.input.line.*@\/\/main()\/Q\/:
  39. T.Z6int.i,.c,.len;\/:int.sum;\/:int.setby,.by;\/:char.ltype;\/\/:line
  40. T.aj_num.=.1;\/Gifdef.msdos\/:setmode(.1,.O_BINARY.);::@*.make.stdout
  41. T.bT.binary.on.DOS.*@\/Gendif\/\/:while(.fgets(.linbuf,.MAX_LLEN,.std
  42. T.cZin.).)Q\/::if(.linbuf[0].>=.'T'.&&.linbuf[0].<=.'Z'.).Q\/:::ltype
  43. T.dT.=.linbuf[4].==.linbuf[5].?.linbuf[4].^.0;\/:::len.=.strlen(linbu
  44. T.eDf);\/:::if(.linbuf[len-1].==.'zn'.)\/::::linbuf[--len].=.0;\/:::.
  45. T.fcelse\/::::continue;:@*.line.too.long.*@\/:::sum.=.0;\/:::for(.i.=
  46. T.gW.4;.i.<.len;.i++.)\/::::sum.+=.linbuf[i];\/:::@*.bad.checksum,.no
  47. T.hgt.a.line.for.us.*@\/:::if(.(sum.%.NUM_SAFE).j=.lnconv(linbuf[3]).
  48. T.iF)\/::::continue;\/:::if(.(.(long)(lnconv(linbuf[0])-SFBYTE)*NUM_S
  49. T.jiAFE+\/:::::lnconv(linbuf[1]))*NUM_SAFE.+\/:::::lnconv(linbuf[2]).
  50. T.kyj=.line_num++.)\/::::bomb_out(JSe{quenceJ);\/:::if(.ltype.==.MAIN
  51. T.lk_HEAD.).Q\/::::if(.linbuf[6].==.'S'.).Q\/:::::int.ver;\/:::::ver.
  52. T.mo=.atoi(linbuf+7);\/:::::if(.ver.>.OUR_VERSION.qq.ver.<.1000.)\/::
  53. T.nf::::bomb_out(.JVersion.numberJ.);\/:::::if(strcmp(linbuf+len-5,J,
  54. T.oUABE1J).j=.0.)\/::::::bomb_out(JBad.Encoding.StyleJ);\/:::::K\/:::
  55. T.pY:.else\/:::::if(.expected_sum.j=.atol(linbuf+7).)\/::::::bomb_out
  56. T.q2(.JChecksumJ.);\/::::K\/:::else.if(.ltype.==.CODE_HEAD.).Q.@*.enc
  57. T.rJoding.map.*@\/::::reduce(.linbuf+6.);\/::::for(.i.=.0;.i.<.8;.i++
  58. T.s4.).Q\/:::::setby.=.linbuf[7+4+i*5];\/:::::for(.by.=.3;.by.>=.0;.b
  59. T.tMy--.).Q\/::::::whatbyte[setby%3][linbuf[7+i*5:\/:::::::+by]].=.li
  60. T.uEnbuf[6]*32+i*4\/:::::::+by;\/::::::setby.@=.NSETS;\/::::::K\/::::
  61. T.v1:K\/::::K\/:::else.if(.jltype.qq.(ltype>=FPRINT.&&.ltype<=LPRINT)
  62. T.w0).Q\/::::@*.decode.a.line.*@\/::::reduce(.linbuf+4.);\/::::expect
  63. T.xxed_sum.=.(expected_sum.+.sum).%.CSUM_MOD;\/::::for(.i.=.4;.i.<.le
  64. T.y4n;.i++.)\/::::..switch(c.=.linbuf[i].+.FPRINT)Q\/::::....case.NEW
  65. T.znSET1^\/::::....case.NEWSET1+1^\/:::::putchar(whatbyte[1+c-NEWSET1
  66. T/.U]\/:::::::[linbuf[++i]]);\/:::::break;\/::::....case.SETXX^\/::::
  67. T//w....case.SETXX+1^\/::::....case.SETXX+2^\/::::....case.SETXX+3^\/
  68. T/0N:::::putchar(whatbyte[1+(c-SETXX)@2]\/:::::::[linbuf[++i]]);\/:::
  69. T/1a::putchar(whatbyte[1+(c-SETXX)%2]\/:::::::[linbuf[++i]]);\/:::::b
  70. T/2Creak;\/::::....case.SET10X^\/::::....case.SET10X+1^\/:::::putchar
  71. T/3u(whatbyte[1][linbuf[++i]]);\/:::::putchar(whatbyte[0][linbuf[++i]
  72. T/4r]);\/:::::putchar(whatbyte[1+c-SET10X]\/:::::::[linbuf[++i]]);\/:
  73. T/5q::::break;\/::::....default^\/:::::putchar(whatbyte[0][c-FPRINT])
  74. T/6n;\/:::::break;\/:::::K\/::::K\/:::K\/::K\/\/K\/@*.reduce.elements
  75. T/7I.of.string.to.numbers.from.0.to.NPRINTS-1.*@\/reduce(str)\/char.*
  76. T/8estr;\/Q\/:while(.*str.)\/::*str++.-=.FPRINT;\/K\/bomb_out(err)\/c
  77. T/99har.*err;\/Q\/:fprintf(.stderr,.JDecode.aborted.-.%s.error,.Line^
  78. T/Am.%3`3sznJ,err,linbuf);\/:fprintf(stderr,.JTry.to.sort.file.or.get
  79. T/By.the.advanced.DABE.decoder`znJ);\/:exit(1);\/K\/lnconv(.n.)::@*.c
  80. T/Cuonvert.line.number.and.checksum.chars.to.ints.*@\/int.n;\/Q\/:ret
  81. T/Dpurn.n.-.(n.>.'9'.?.(n.>.'Z'.?.'a'-38.^.'A'-12).^.'`');\/K\/
  82. T/Ex$$end_file=tdabe1.c
  83. T/FE$$filecrc32=4079990116
  84. T/G5##E63300
  85. ;End of ABE encoding
  86. T/HN##S1000,1000,1000,ABE1
  87. T/IN$$blocking=false
  88. T/JS$$uname=tdabe2.c
  89. T/Ka$$os=gemdos
  90. T/LK$$fname=tiny_src\tdabe2.c
  91. T/M.$$date=614524968
  92. T/Nd$$perm=0
  93. T/OD$$size=4083
  94. T/PB""%EA>=M<;:9M8:/7A6\54D32?0M/.-,M+1*)M(&%'M
  95. T/Qp""&.`JK%z%&'%()*+%,-P@%0123%4567%89G;%<=>?%
  96. T/RN""'@ABC@DEFG&HIJK)LMNO%PQRSITUVW&XYZ[%j]^_(
  97. T/S3""(`abc@defg%hijk(lmno%pqrs%tuvw%xyzW(^QCD)
  98. T/TL"")BFHIMLMNOMRSTUMVXYZM[\]_MabcdMefghMiklmM
  99. T/Ue""*nopqMrstuMvwxyM%&'(u)*+,u-./0u1234u5678u
  100. T/Vb""+9:;<u=>?@uABCDuEFGHuIJKLuMNOPuQRSTuUVWXu
  101. T/Wc"",YZ[\u]^_`uabcduefghuijklumnopuqrstuuvwxu
  102. T/Xf\/@*.Tiny.ABE.'Ascii-Binary.Encoding'.Decoder.for.ABE2.(4.sets@64
  103. T/Y2,.85.printables)\/...'sort'.ALL.THE.IN{PUT.FILES.TO{GETHER.IF.THE
  104. T/ZiY'RE.NOT.IN.ORDERP\/...Try.to.get.the.full.version.of.this.progra
  105. T/a7m.from.various.archivesP\/...This.program.is.mainly.meant.as.a.te
  106. T/bdmporary.version.for.Unix.usersP\/...DEFINE.THE.SYMBOL.JmsdosJ.on.
  107. T/ciDOS.MACHINESP\/...By.Brad.TempletonP..This.code.is.released.to.th
  108. T/dve.public.domainP..No\/...warranties.are.provided.or.impliedP.*@\/
  109. T/eZ\/\/Kinclude.<stdioPh>\/Kifdef.msdos\/Kinclude.<fcntlPh>::@*.to.g
  110. T/fnet.the.MSDOS.O_BINARY.symbol.only.*@\/Kendif.msdos\/Kdefine.OUR_V
  111. T/g3ERSION.1000\/Kdefine.MAX_LLEN.80::@*.max.output.line.len.*@\/Kdef
  112. T/hYine.NSETS.4:::@*.number.of.character.sets.*@\/Kdefine.SFBYTE.31\/
  113. T/i5Kdefine.NUM_SAFE.64\/Kdefine.CSUM_MOD.65536\/\/@*.header.characte
  114. T/jXrs.*@\/Kdefine.CODE_HEAD.'J'\/Kdefine.MAIN_HEAD.'K'\/Kdefine.isma
  115. T/kvpchar(x).((x>='P'&&x<='9')^^(x>='A'&&x<='Z')^^(x>='a'&&x<='{z'))\
  116. T/lu/\/long.line_num;\/long.expected_sum.=.0;\/extern.long.atol();\/i
  117. T/mCnt.whatbyte[NSETS][NUM_SAFE];:@*.array.maps.printables.to.bytes.*
  118. T/nZ@\/char.linbuf[MAX_LLEN];::@*.input.line.*@\/\/main()\/W\/:int.i,
  119. T/oI.c,.len;\/:int.sum;\/:int.setby,.by;\/:char.ltype;\/\/:line_num.=
  120. T/pH.1;\/Kifdef.msdos\/:setmode(.1,.O_BINARY.);::@*.make.stdout.binar
  121. T/qiy.on.DOS.*@\/Kendif\/\/:while(.fgets(.linbuf,.MAX_LLEN,.stdin.).)
  122. T/r6W\/::if(.linbuf[0].>=.'T'.&&.linbuf[0].<=.'Z'.).W\/:::ltype.=.lin
  123. T/svbuf[4].==.linbuf[5].?.linbuf[4].G.0;\/:::len.=.strlen(linbuf);\/:
  124. T/tY::if(.linbuf[len-1].==.'jn'.)\/::::linbuf[--len].=.0;\/:::.else\/
  125. T/uK::::continue;:@*.line.too.long.*@\/:::sum.=.0;\/:::for(.i.=.4;.i.
  126. T/v4<.len;.i++.)\/::::sum.+=.linbuf[i];\/:::@*.bad.checksum,.not.a.li
  127. T/w.ne.for.us.*@\/:::if(.(sum.%.NUM_SAFE).`=.bconv(linbuf[3]).)\/::::
  128. T/xncontinue;\/:::if(.(.(long)(bconv(linbuf[0])-SFBYTE)*NUM_SAFE+\/::
  129. T/yx:::bconv(linbuf[1]))*NUM_SAFE.+\/:::::bconv(linbuf[2]).`=.line_nu
  130. T/zQm++.)\/::::bomb_out(JSequenceJ);\/:::if(.ltype.==.MAIN_HEAD.).W\/
  131. T0.7::::if(.linbuf[6].==.'S'.).W\/:::::int.ver;\/:::::ver.=.atoi(linb
  132. T0/ouf+7);\/:::::if(.ver.>.OUR_VERSION.^^.ver.<.1000.)\/::::::bomb_ou
  133. T00qt(.JVersion.numberJ.);\/:::::if(strcmp(linbuf+len-5,J,ABE2J).`=.0
  134. T01F.)\/::::::bomb_out(JBad.Encoding.StyleJ);\/:::::Q\/::::.else\/:::
  135. T02X::if(.expected_sum.`=.atol(linbuf+7).)\/::::::bomb_out(.JChecksum
  136. T03GJ.);\/::::Q\/:::else.if(.ltype.==.CODE_HEAD.).W.@*.enco